package com.yct.springcloud.controller;


import com.yct.springcloud.entity.pay.Payment;
import com.yct.springcloud.service.IPaymentService;
import com.yct.springcloud.support.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单Controller
 */
@RestController
@Slf4j
public class OrderController {

    @Autowired
    IPaymentService iPaymentService;

    @GetMapping(value = "/consumer/payment/feign/getPayment/{id}")
    public CommonResult<Payment> getPayment(@PathVariable("id") Long id) {

        log.info("Consumer：根据id【" + id + "】查询支付数据。");

        return iPaymentService.getPaymentById(id);

    }

    /**
     * 测试延时返回
     * @return
     */
    @GetMapping(value = "/consumer/payment/feign/timeout")
    public CommonResult feignTimeout() {

        return iPaymentService.feignTimeout();
    }
}
